package com.cat.dataStructure;

/**
 *   @description https://leetcode.cn/problems/largest-magic-square/
 *   @author 曲大人的喵
 *   @create 2025/8/20 15:20
 *   @since JDK17
 */

public class Solution39 {
    int[][] row, col;
    boolean check(int x, int y, int k) {
        if (row[x][y + k] - row[x][y] != col[y][x + k] - col[y][x]) {
            return false;
        }
        for (int i = 1; i < k; i++) {   // 每一行都相同

        }


        return true;
    }

    public int largestMagicSquare(int[][] grid) {
        int n = grid.length, m = grid[0].length, ans = 1;
        row = new int[n][m + 1];
        col = new int[m][n + 1];
        for (int i = 0; i < n; i++) {   // 行的前缀和
            for (int j = 0; j < m; j++) {
                row[i][j + 1] = row[i][j] + grid[i][j];
            }
        }
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                col[j + 1][i] = col[j][i] + grid[j][i];
            }
        }
//        for (int i = 0; i < m; i++) {
//            for (int j = 0; j <= n; j++) {
//                System.out.print(col[i][j] + " ");
//            }
//            System.out.println();
//        }
        for (int i = 0; i < n - ans; i++) {
            for (int j = 0; j < m - ans; j++) {
                for (int k = ans + 1; i + k <= n && j + k <= m; k++) {

                }
            }
        }


        return ans;
    }
}
